<?php
namespace app\model\admin;

use think\Db;

class Charts
{
    //获取蜘蛛列表
    public function get_spider_lists($where,$sort='',$paginate=10)
    {
        $result_lists = Db::name('spider')->order($sort)->paginate($paginate);
        return $result_lists;
    }

    //获取蜘蛛列表-between条件
    public function get_spider_lists_between($between='',$sort='',$paginate=10)
    {
        $result_lists = Db::name('spider')->where($between['val'],'between',''.$between['one'].','.$between['two'].'')->order($sort)->paginate($paginate);
        return $result_lists;
    }

    public function spider_charts_pie($between='',$where){
        $result = Db::name('spider')->where($where)->where($between['val'],'between',''.$between['one'].','.$between['two'].'')->field('spider,count(id) as num')->group('spider')->select();
        return $result;
    }

    public function spider_charts_line($between='',$where){
        $result = Db::name('spider')->where($where)->where($between['val'],'between',''.$between['one'].','.$between['two'].'')->field('spider,time')->select();
        return $result;
    }
}


